﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using hou_elearning.Entity;
using hou_elearning.Business;
using System.Data;
public partial class Admin_control_minhtest : System.Web.UI.UserControl
{
    private List<PhuonganEntity> glbLstGrvDatasource = new List<PhuonganEntity>();
    
   // PhuonganEntity[] pa = new PhuonganEntity[6];
    //DataTable tb = new DataTable();
  
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["list"]!=null)
        glbLstGrvDatasource = (List<PhuonganEntity>)Session["list"];
        loadgrv();
    }

    protected void btnThem_Click(object sender, EventArgs e)
    {
        PhuonganEntity pa = new PhuonganEntity();        
        pa.sNoidung = txtChude.Text;
        pa.bDung = true;
        pa.dNgaytao = DateTime.Now;
        pa.dNgaycapnhat = DateTime.Now;
        pa.FK_iNguoitao = 2;
        pa.FK_iNguoicapnhat = 2;
        pa.FK_iDanhmuccauhoiID = 1;
        pa.PK_iPhuonganID =1;
        glbLstGrvDatasource.Add(pa);
        Session["list"] = glbLstGrvDatasource;
        //tb.Rows.Add(pa);
        loadgrv();
        
        thongbao.Text = glbLstGrvDatasource.Count+"";
    }
    private void loadgrv()
    {
        grvDapan.DataSource = glbLstGrvDatasource;
        grvDapan.DataBind();
    }

}